angular.module('tribalc').directive('focusMe', ['$timeout', '$parse', function ($timeout, $parse) {
    return {
        //scope: true,   // optionally create a child scope
        link: function (scope, element, attrs) {
            var model = $parse(attrs.focusMe);
            scope.$watch(model, function (value) {
                //console.log('value=', value);
                if (value === true ||value === false) {
                    $timeout(function () {
                        element[0].focus();
                    });
                }
            });

        }
    };
}]);